var express = require("express");
var router = express.Router();
const bodyParser = require("body-parser");

//处理 querystring 格式的请求体
let urlParser = bodyParser.urlencoded({ extended: false });
//处理 JSON 格式的请求体
let jsonParser = bodyParser.json();

router.post("/login", urlParser, (request, response) => {
  //用户名
  console.log(request.body.username);
  //密码
  console.log(request.body.userpass);
  response.send({
    code: 200,
    message: "登录成功",
  });
});

/* GET home page. */
router.get("/", function (req, res, next) {
  res.json({ message: "hello Express !!" });
});

module.exports = router;
